<template>
    <el-table
        ref="multipleTable"
        :data="tableData"
        tooltip-effect="dark"
        @selection-change="handleSelectionChange">
        <el-table-column
            type="selection"
            width="55">
        </el-table-column>
        <el-table-column
            label="字段"
            width="200">
        <template slot-scope="scope">{{ scope.row.date }}</template>
    </el-table-column>
</el-table>
</template>
<script>
export default {
      data(){
      return {
        user:this.$route.params.user,
        permission:'000000000000000000000000000000000000',
        permissionObject:[],
        tableData:[],
        multipleSelection: [],
        nameList: {},
        sqlNames:[
            'collectionname',
            'sku',
            'eancode',
            'desiginid',
            'supplierdesignid',
            'qualityid',
            'picture',
            'weight',
            'grossweight',
            'width',
            'height',
            'length',
            'dimensions',
            'colormap',
            'size',
            'fobpricesqm',
            'fobpricepcs','warehousecostsqm','warehousecostpcs','wholesalepricesqm',
            'wholesalepricepcs',
            'commisionsqm','commisionpcs','barcodefiles','retailprice','saleprice','material',
            'pileheight',
            'origin',
            'isburn',
            'iscolor',
            'iselectric',
            'iswater',
            'ismildew',
            'resilience',
            'nonshedding',
            'isslippery',
            'soft',
            'back',
            'iswash',
            'issmell'
        ],
        tableNames:[
            'Collection Name',
            'SKU',
            'EAN CODE',
            'Design ID',
            'Supplier Design ID',
            'Quality类别代码',
            'Picture',
            'Weight/Sqm (Kgs)',
            'Gross Weight',
            'width',
            'height',
            'length',
            'Dimensions(W*H*L) ',
            'Color Map',
            'Size',
            'FOB Price/Sqm',
            'FOB Price/PCS',
            'Warehouse Cost/SQM',
            'Warehouse Cost/PC',
            'Wholesale Prices/sqm',
            'Wholesale Prices/PCS',
            'Commision/sqm',
            'Commision/PCS',
            'Barcode Files',
            '建议零售价',
            '售价',
            'Sqm',
            'Material',
            'Pile Height',
            'Origin',
            '是否阻燃',
            '是否掉色',
            '是否防静电',
            '是否防水',
            '是否防霉',
            'Resilience(回弹性能）',
            'Non Shedding',
            '柔软舒适度',
            '背部工艺',
            '是否可水洗',
            '是否有异味'
        ],
        userPermission:[]
      }
  },
  created(){
      for(var value of this.tableNames){
          var item = {date:value};
          this.tableData.push(item);
      }
      for(var i=0;i<this.tableNames.length;i++){
          this.nameList[this.tableNames[i]] = this.sqlNames[i]
      }

  },
    methods:{
      handleSelectionChange(val) {
        this.multipleSelection = val;
        this.userPermission = [];
        for(var value of this.multipleSelection){
            this.userPermission.push(this.transTo(value.date))
        }

        this.$emit('authorities',this.userPermission)
        // console.log(this.userPermission)
      },
      transTo(str){
          return this.nameList[str];
      },
  },
}
</script>
<style scoped>

</style>
